<template>
  <div>
    <button @click="add">+todo</button>
    <hr>
    todo num
    <!-- {{ $store.state.todo.num }} -->
    {{ num }}
    <br />
    a num
    {{ numa }}
    <!-- {{ $store.state.a.num }} -->
  </div>
</template>

<script>
import { mapState, mapMutations } from 'vuex'
export default {
  methods: {
    add () {
      // this.$store.commit('todo/addNum', 10)
      // this['todo/addNum'](20)
      this.addNum(50)
    },
    // ...mapMutations(['todo/addNum'])
    ...mapMutations('todo', ['addNum'])
    // ...mapMutations('a', ['addNum'])
  },
  mounted () {
    console.log(this.$store)
  },
  computed: {
    ...mapState({
      num: state => state.todo.num,
      numa: state => state.a.num
    })
  }
}
</script>

<style lang="scss" scoped>

</style>
